<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Matrix207&#39;s Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="Matrix207's Blog">
<meta property="og:url" content="http://yoursite.com/page/3/index.html">
<meta property="og:site_name" content="Matrix207's Blog">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Matrix207's Blog">
  
    <link rel="alternate" href="/atom.xml" title="Matrix207&#39;s Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Matrix207&#39;s Blog</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="Flux RSS"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Rechercher"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-lua" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/11/04/lua/" class="article-date">
  <time datetime="2015-11-03T16:00:00.000Z" itemprop="datePublished">2015-11-04</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/language/">language</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/11/04/lua/">lua</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="what-is-Lua"><a href="#what-is-Lua" class="headerlink" title="what is Lua"></a>what is Lua</h3><h3 id="what-can-Lua-do"><a href="#what-can-Lua-do" class="headerlink" title="what can Lua do?"></a>what can Lua do?</h3><h3 id="how-to-implement"><a href="#how-to-implement" class="headerlink" title="how to implement?"></a>how to implement?</h3><h3 id="what-is-the-advantages-and-disadvantages"><a href="#what-is-the-advantages-and-disadvantages" class="headerlink" title="what is the advantages and disadvantages?"></a>what is the advantages and disadvantages?</h3><h3 id="how-to-use-Lua"><a href="#how-to-use-Lua" class="headerlink" title="how to use Lua?"></a>how to use Lua?</h3><h3 id="compare-with-other-scripts"><a href="#compare-with-other-scripts" class="headerlink" title="compare with other scripts"></a>compare with other scripts</h3><h3 id="code-analysis"><a href="#code-analysis" class="headerlink" title="code analysis"></a>code analysis</h3><h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><p><a href="https://www.chenlq.net/dev/cpp-why/46-what-are-the-characteristics-of-the-scripting-language-lua-compared-with-python-ruby-perl-etc.html" target="_blank" rel="external">features of Lua</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/11/04/lua/" data-id="ciqqpe1ub00dtnmpvryogwxst" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/lua/">lua</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-database-knowledge" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/11/04/database-knowledge/" class="article-date">
  <time datetime="2015-11-03T16:00:00.000Z" itemprop="datePublished">2015-11-04</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/database/">database</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/11/04/database-knowledge/">Database knowledges</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><p><code>DDL</code> is Data Definition Language (DDL) statements are used to define the database<br>structure or schema. Some examples:  </p>
<p>  CREATE - to create table in the database<br>  ALTER - alters the structure of the database<br>  DROP - delete objects from the database<br>  TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed<br>  COMMENT - add comments to the data dictionary<br>  RENAME - rename an object </p>
</li>
<li><p><code>DML</code> is Data Manipulation Language (DML) statements are used to managing data<br>with schema objects. Some examples:  </p>
<p>  SELECT - retrieve data from the a database<br>  INSERT - insert data into a table<br>  UPDATE - updates existing data within a table<br>  DELETE - deletes all records from a table, the space for the records remain<br>  MERGE - UPSERT operation (insert or update)<br>  CALL - call a PL/SQL or Java subprogram<br>  EXPLAIN PLAN - explain access path to data<br>  LOCK TABLE - control concurrency </p>
</li>
<li><p><code>DCL</code> is Data Control Language (DCL) statements.</p>
</li>
<li><code>TCL</code> is Transaction Control Language (DCL) statements.</li>
</ul>
<h3 id="事务"><a href="#事务" class="headerlink" title="事务"></a>事务</h3><ul>
<li>ACID<ul>
<li>Atomic 原子性</li>
<li>Con 一致性</li>
<li>Isolation 隔离性</li>
<li>D 持久性</li>
</ul>
</li>
<li>并发场景<ul>
<li>脏读:</li>
<li>不可重复读</li>
<li>幻读</li>
</ul>
</li>
</ul>
<h3 id="Index"><a href="#Index" class="headerlink" title="Index"></a>Index</h3><ul>
<li>structure<ul>
<li>B-/B+ tree</li>
</ul>
</li>
</ul>
<h3 id="Reference-1"><a href="#Reference-1" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://liyuan2005.iteye.com/blog/209218" target="_blank" rel="external">数据库中的DML，DCL，DDL分别是那些操作？</a></li>
<li><a href="http://blog.jobbole.com/100349" target="_blank" rel="external">数据库原理一</a></li>
<li><a href="http://blog.jobbole.com/100349" target="_blank" rel="external">数据库原理二</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/11/04/database-knowledge/" data-id="ciqqpe1u800dqnmpvpzd4tly9" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/database/">database</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-network-freedom" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/11/01/network-freedom/" class="article-date">
  <time datetime="2015-10-31T16:00:00.000Z" itemprop="datePublished">2015-11-01</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/others/">others</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/11/01/network-freedom/">network freedom</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Modify-hosts-file"><a href="#Modify-hosts-file" class="headerlink" title="Modify hosts file"></a>Modify hosts file</h3><ul>
<li>modify /etc/hosts file</li>
<li>restart network<ul>
<li>On fedora, use <code>systemctl restart NetworkManager</code></li>
<li>On ubuntu, use ??</li>
</ul>
</li>
<li>fly on internet freedom</li>
</ul>
<h3 id="Using-proxy"><a href="#Using-proxy" class="headerlink" title="Using proxy"></a>Using proxy</h3><h3 id="Using-VPN"><a href="#Using-VPN" class="headerlink" title="Using VPN"></a>Using VPN</h3><h3 id="Build-VPN-on-VPS"><a href="#Build-VPN-on-VPS" class="headerlink" title="Build VPN on VPS"></a>Build VPN on VPS</h3><ul>
<li>linode</li>
</ul>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="https://github.com/racaljk/hosts" target="_blank" rel="external">最新可用的google hosts文件</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/11/01/network-freedom/" data-id="ciqqpe1u200dmnmpv1httvtbw" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/google/">google</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/hosts/">hosts</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-write-document-with-sphinx" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/10/25/write-document-with-sphinx/" class="article-date">
  <time datetime="2015-10-24T16:00:00.000Z" itemprop="datePublished">2015-10-25</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/tools/">tools</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/10/25/write-document-with-sphinx/">write document with sphinx</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Introduce"><a href="#Introduce" class="headerlink" title="Introduce"></a>Introduce</h3><p>Sphinx is tool that make it easy to create intelligent and beautiful documentation.<br>For more information, go to here <a href="http://sphinx-doc.org/" target="_blank" rel="external">http://sphinx-doc.org/</a></p>
<h3 id="Install"><a href="#Install" class="headerlink" title="Install"></a>Install</h3><ul>
<li><code>easy-install -U sphinx</code></li>
</ul>
<h3 id="Example"><a href="#Example" class="headerlink" title="Example"></a>Example</h3><ul>
<li><a href="http://sphinx-doc.org/examples.html" target="_blank" rel="external">http://sphinx-doc.org/examples.html</a></li>
</ul>
<h3 id="My-TODO-list"><a href="#My-TODO-list" class="headerlink" title="My TODO list"></a>My TODO list</h3><ul>
<li>write a book for VIM</li>
<li>write a book to introduce database in memory</li>
</ul>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://sphinx-doc.org/" target="_blank" rel="external">SPHINX python document generator</a></li>
<li><a href="http://hyry.dip.jp/tech/book/page/sphinx/setup.html" target="_blank" rel="external">用Sphinx写书</a></li>
<li><a href="http://avnpc.com/pages/writing-best-documentation-by-sphinx-github-readthedocs" target="_blank" rel="external">写最好的文档：Sphinx + Read the Docs</a></li>
<li><a href="https://github.com/huangz1990/redisbook/" target="_blank" rel="external">redis book write by sphinx</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/10/25/write-document-with-sphinx/" data-id="ciqqpe1tz00djnmpvmfjnozxv" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/write/">write</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-redis" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/10/24/redis/" class="article-date">
  <time datetime="2015-10-23T16:00:00.000Z" itemprop="datePublished">2015-10-24</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/database/">database</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/10/24/redis/">redis</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Redis"><a href="#Redis" class="headerlink" title="Redis"></a>Redis</h3><p>Redis is an in-memory database that persist on disk. The data model is key-value,<br>but many different kind of values are supported: String, Lists, Sets, Sorted Set,<br>Hashes, HyperLogLog, Bitmaps.<a href="http://redis.io" target="_blank" rel="external">http://redis.io</a></p>
<h3 id="Install"><a href="#Install" class="headerlink" title="Install"></a>Install</h3><ul>
<li>Download, extract and compile Redis with:<br>  $ wget <a href="http://download.redis.io/releases/redis-3.0.5.tar.gz" target="_blank" rel="external">http://download.redis.io/releases/redis-3.0.5.tar.gz</a><br>  $ tar xzf redis-3.0.5.tar.gz<br>  $ cd redis-3.0.5<br>  $ make</li>
</ul>
<h3 id="Use"><a href="#Use" class="headerlink" title="Use"></a>Use</h3><ul>
<li><p>Playing with Redis</p>
<p>  % cd src<br>  % ./redis-cli<br>  redis&gt; ping<br>  PONG<br>  redis&gt; set foo bar<br>  OK<br>  redis&gt; get foo<br>  “bar”<br>  redis&gt; incr mycounter<br>  (integer) 1<br>  redis&gt; incr mycounter<br>  (integer) 2<br>  redis&gt;</p>
</li>
</ul>
<h3 id="Analyze"><a href="#Analyze" class="headerlink" title="Analyze"></a>Analyze</h3><ul>
<li>size of source code, 1.3MB</li>
<li>total lines of code, 58185</li>
<li>allocate double memory size when append string</li>
</ul>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://redis.io/" target="_blank" rel="external">redis</a></li>
<li><a href="https://github.com/antirez/redis" target="_blank" rel="external">redis on github</a></li>
<li><a href="http://origin.redisbook.com/" target="_blank" rel="external">redis book</a></li>
<li><a href="https://github.com/huangz1990/redisbook" target="_blank" rel="external">redis book source</a></li>
<li><a href="http://redisdoc.com/" target="_blank" rel="external">Redis 命令参考</a></li>
<li><a href="https://github.com/huangz1990/annotated_redis_source" target="_blank" rel="external">带有详细注释的 Redis 2.6 源码</a></li>
<li><a href="https://github.com/springside/springside4/wiki/redis" target="_blank" rel="external">关于Redis的常识</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/10/24/redis/" data-id="ciqqpe1tw00dgnmpv6yrfnhkj" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/database/">database</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-mongodb" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/10/24/mongodb/" class="article-date">
  <time datetime="2015-10-23T16:00:00.000Z" itemprop="datePublished">2015-10-24</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/database/">database</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/10/24/mongodb/">mongodb</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="MongoDB"><a href="#MongoDB" class="headerlink" title="MongoDB"></a>MongoDB</h3><h3 id="Install"><a href="#Install" class="headerlink" title="Install"></a>Install</h3><h3 id="Use"><a href="#Use" class="headerlink" title="Use"></a>Use</h3><h3 id="Analyze-C-driver"><a href="#Analyze-C-driver" class="headerlink" title="Analyze C++ driver"></a>Analyze C++ driver</h3><ul>
<li>download code from <a href="https://github.com/mongodb/mongo-cxx-driver" target="_blank" rel="external">https://github.com/mongodb/mongo-cxx-driver</a></li>
<li>size, about 60000, too big.</li>
</ul>
<h3 id="Analyze-source-code"><a href="#Analyze-source-code" class="headerlink" title="Analyze source code"></a>Analyze source code</h3><ul>
<li>download code from <a href="https://github.com/mongodb/mongo" target="_blank" rel="external">https://github.com/mongodb/mongo</a></li>
</ul>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="https://www.mongodb.org" target="_blank" rel="external">MongoDB</a></li>
<li><a href="https://www.mongodb.org/about/source-code/" target="_blank" rel="external">MongoDB source code</a></li>
<li><a href="http://github.com/mongodb" target="_blank" rel="external">MongoDB on github</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/10/24/mongodb/" data-id="ciqqpe1tq00d9nmpvxvukgyyt" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/database/">database</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-linux-memory" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/10/24/linux-memory/" class="article-date">
  <time datetime="2015-10-23T16:00:00.000Z" itemprop="datePublished">2015-10-24</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/program/">program</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/10/24/linux-memory/">linux memory</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="process-and-memory"><a href="#process-and-memory" class="headerlink" title="process and memory"></a>process and memory</h3><ul>
<li><p>how process use memory<br>There are 5 kinds of segment datas on process, which is code segment, data segment,<br>BSS segment, heap segment and stack segment.</p>
<ul>
<li>code, use for store execute instruction.</li>
<li>data, store global variable, which had been initialized.</li>
<li>BSS, uninitialized global variable, all would be setted to zero.</li>
<li>heap, memory be allocated dynamic</li>
<li>stack, use for store local variable</li>
</ul>
</li>
<li><p>how these segments look like</p>
<ul>
<li>|stack address … heap address … BSS … data … code|</li>
<li>stack address is on high address, and code is on low.</li>
<li><p>here is an example to tell the ture  </p>
<pre><code>#include&lt;stdio.h&gt;
#include&lt;malloc.h&gt;
#include&lt;unistd.h&gt;
int bss_var;
int data_var0=1;
int main(int argc,char **argv)
{
  printf(&quot;below are addresses of types of process&apos;s mem\n&quot;);
  printf(&quot;Text location:\n&quot;);
  printf(&quot;\tAddress of main(Code Segment):%p\n&quot;,main);
  printf(&quot;____________________________\n&quot;);
  int stack_var0=2;
  printf(&quot;Stack Location:\n&quot;);
  printf(&quot;\tInitial end of stack:%p\n&quot;,&amp;stack_var0);
  int stack_var1=3;
  printf(&quot;\tnew end of stack:%p\n&quot;,&amp;stack_var1);
  printf(&quot;____________________________\n&quot;);
  printf(&quot;Data Location:\n&quot;);
  printf(&quot;\tAddress of data_var(Data Segment):%p\n&quot;,&amp;data_var0);
  static int data_var1=4;
  printf(&quot;\tNew end of data_var(Data Segment):%p\n&quot;,&amp;data_var1);
  printf(&quot;____________________________\n&quot;);
  printf(&quot;BSS Location:\n&quot;);
  printf(&quot;\tAddress of bss_var:%p\n&quot;,&amp;bss_var);
  printf(&quot;____________________________\n&quot;);
  char *b = sbrk((ptrdiff_t)0);
  printf(&quot;Heap Location:\n&quot;);
  printf(&quot;\tInitial end of heap:%p\n&quot;,b);
  brk(b+4);
  b=sbrk((ptrdiff_t)0);
  printf(&quot;\tNew end of heap:%p\n&quot;,b);
  return 0;
}
</code></pre></li>
<li>output as below  <pre><code>below are addresses of types of process&apos;s mem
Text location:
    Address of main(Code Segment):0x400606
____________________________
Stack Location:
    Initial end of stack:0x7fff8b4d1b5c
    new end of stack:0x7fff8b4d1b58
____________________________
Data Location:
    Address of data_var(Data Segment):0x601050
    New end of data_var(Data Segment):0x60104c
____________________________
BSS Location:
    Address of bss_var:0x601058
____________________________
Heap Location:
    Initial end of heap:0x203c000
    New end of heap:0x203c004
</code></pre></li>
</ul>
</li>
<li>memory space of process<br>Linux use virtual memory address to express the process memory space, it make<br>all the process have isolate physic memory space, they will not interfere with<br>each other.</li>
<li>process memory manager<br>Use command <code>cat /proc/[pid]/maps</code> can show the memory information of process.</li>
<li>allocate and recover process memory </li>
<li>system physic memory manager</li>
</ul>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://www.kerneltravel.net/journal/v/mem.htm" target="_blank" rel="external">Linux内存管理</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/10/24/linux-memory/" data-id="ciqqpe1to00d6nmpvi57028jm" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/memory/">memory</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-rdtsc" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/10/24/rdtsc/" class="article-date">
  <time datetime="2015-10-23T16:00:00.000Z" itemprop="datePublished">2015-10-24</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/program/">program</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/10/24/rdtsc/">rdtsc</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="What-is-rdtsc"><a href="#What-is-rdtsc" class="headerlink" title="What is rdtsc"></a>What is rdtsc</h3><ul>
<li>rdtsc is ReaD TimeStamp Count</li>
<li>limition<ul>
<li>only work on x86 platform</li>
</ul>
</li>
</ul>
<h3 id="simple-implement-use-for-x86-64-platform"><a href="#simple-implement-use-for-x86-64-platform" class="headerlink" title="simple implement use for x86_64 platform"></a>simple implement use for x86_64 platform</h3><pre><code>uint64_t rdtsc()
{
   uint32_t hi, lo;
   __asm__ __volatile__ (&quot;rdtsc&quot; : &quot;=a&quot;(lo), &quot;=d&quot;(hi));
   return ( (uint64_t)lo)|( ((uint64_t)hi)&lt;&lt;32 );
}
</code></pre><h3 id="rdtsc-h"><a href="#rdtsc-h" class="headerlink" title="rdtsc.h"></a>rdtsc.h</h3><pre><code>#ifndef __RDTSC_H_DEFINED__
#define __RDTSC_H_DEFINED__


#if defined(__i386__)

static __inline__ unsigned long long rdtsc(void)
{
  unsigned long long int x;
     __asm__ volatile (&quot;.byte 0x0f, 0x31&quot; : &quot;=A&quot; (x));
     return x;
}
#elif defined(__x86_64__)

static __inline__ unsigned long long rdtsc(void)
{
  unsigned hi, lo;
  __asm__ __volatile__ (&quot;rdtsc&quot; : &quot;=a&quot;(lo), &quot;=d&quot;(hi));
  return ( (unsigned long long)lo)|( ((unsigned long long)hi)&lt;&lt;32 );
}

#elif defined(__powerpc__)

static __inline__ unsigned long long rdtsc(void)
{
  unsigned long long int result=0;
  unsigned long int upper, lower,tmp;
  __asm__ volatile(
                &quot;0:                  \n&quot;
                &quot;\tmftbu   %0           \n&quot;
                &quot;\tmftb    %1           \n&quot;
                &quot;\tmftbu   %2           \n&quot;
                &quot;\tcmpw    %2,%0        \n&quot;
                &quot;\tbne     0b         \n&quot;
                : &quot;=r&quot;(upper),&quot;=r&quot;(lower),&quot;=r&quot;(tmp)
                );
  result = upper;
  result = result&lt;&lt;32;
  result = result|lower;

  return(result);
}

#else

#error &quot;No tick counter is available!&quot;

#endif


/*  $RCSfile:  $   $Author: kazutomo $
 *  $Revision: 1.6 $  $Date: 2005/04/13 18:49:58 $
 */

#endif
</code></pre><h3 id="Sample-one"><a href="#Sample-one" class="headerlink" title="Sample one"></a>Sample one</h3><pre><code>#include &lt;stdio.h&gt;
#include &quot;rdtsc.h&quot;

int main(int argc, char* argv[])
{
  unsigned long long a,b;

  a = rdtsc();
  b = rdtsc();

  printf(&quot;%llu\n&quot;, b-a);
  return 0;
}
</code></pre><h3 id="Sample-two"><a href="#Sample-two" class="headerlink" title="Sample two"></a>Sample two</h3><pre><code>#include &lt;stdio.h&gt;
#include &lt;assert.h&gt;
#include &lt;stdint.h&gt;
#include &lt;stdlib.h&gt;

#include &quot;rdtsc.h&quot;

#define N (1024*1024*2)

int main(int argc, char* argv[])
{
  unsigned long long a,b;
  unsigned long long min,max;
  char* p;
  int i;

  p = (char*)malloc(N);
  assert( p!=(char*)0 );

  max = 0;
  min = UINT64_MAX;

  for(i=0; i&lt;N; i++ ) {
    a = rdtsc();
    p[i] = 0;
    b = rdtsc() - a;
    if( b &gt; max ) max = b;
    else if( b &lt; min ) min = b;
  }
  printf(&quot;min=%llu\n&quot;, min);
  printf(&quot;max=%llu\n&quot;, max);
  return 0;
}
</code></pre><h3 id="TODO-translate-CPU-cycle-to-time"><a href="#TODO-translate-CPU-cycle-to-time" class="headerlink" title="TODO: translate CPU cycle to time"></a>TODO: translate CPU cycle to time</h3><ul>
<li><code>time_in_seconds = number_of_clock_cycles / frequency</code></li>
<li><code>cat /proc/cpuinfo |grep &#39;MHz&#39;</code></li>
<li><code>gettimeofday</code> and <code>rdtsc</code></li>
</ul>
<h3 id="Something-need-to-consider"><a href="#Something-need-to-consider" class="headerlink" title="Something need to consider?"></a>Something need to consider?</h3><ul>
<li>Context switch?</li>
<li>Multi-core processors</li>
</ul>
<h3 id="gettimeofday"><a href="#gettimeofday" class="headerlink" title="gettimeofday"></a>gettimeofday</h3><pre><code>#include &lt;iostream&gt;
#include &lt;sys/time.h&gt; // for gettimeofday()
using namespace std;

int main()
{
    struct timeval t1, t2;
    double elapsedTime;

    // start timer
    gettimeofday(&amp;t1, NULL);

    // do something
    // ...

    // stop timer
    gettimeofday(&amp;t2, NULL);

    // compute and print the elapsed time in millisec
    elapsedTime = (t2.tv_sec - t1.tv_sec) * 1000.0;    // sec to ms
    elapsedTime += (t2.tv_usec - t1.tv_usec) / 1000.0; // us to ms
    cout &lt;&lt; elapsedTime &lt;&lt; &quot; ms.\n&quot;;

    return 0;
}
</code></pre><h3 id="gettimeofday-vs-rdtsc-source-code"><a href="#gettimeofday-vs-rdtsc-source-code" class="headerlink" title="gettimeofday vs rdtsc, source code"></a>gettimeofday vs rdtsc, source code</h3><pre><code>#include &lt;iostream&gt;
#include &lt;sys/time.h&gt; // for gettimeofday()
#include &lt;stdlib.h&gt; // for malloc
#include &lt;string.h&gt; // for memcpy
#include &quot;rdtsc.h&quot;

// cat /proc/cpuinfo |grep &apos;MHz&apos;
#define CPUMHZ 1200.0f
// frequency per micro second
#define CPU_SPEED_US (CPUMHZ*1024*1024/1000/1000)

using namespace std;
int main()
{
    // test malloc
    cout &lt;&lt; &quot;malloc:\n&quot;;
    struct timeval t1, t2;
    double elapsedTime;
    gettimeofday(&amp;t1, NULL);
    char* p = (char*)malloc(4);
    gettimeofday(&amp;t2, NULL);
    free(p);
    elapsedTime = (t2.tv_sec - t1.tv_sec) * 1000000.0; // sec to us
    elapsedTime += (t2.tv_usec - t1.tv_usec) ;
    cout &lt;&lt; &quot;\t&quot; &lt;&lt; elapsedTime &lt;&lt; &quot; us (by gettimeofday)\n&quot;;

    unsigned long long a,b;
    a = rdtsc();
    char* q = (char*)malloc(4);
    b = rdtsc() - a;
    free(q);
    cout &lt;&lt; &quot;\ttimestamp count is &quot; &lt;&lt; b &lt;&lt; &quot;, elapsedTime &quot; &lt;&lt; b/CPU_SPEED_US &lt;&lt; &quot; us\n&quot;;

    // test memcpy
    cout &lt;&lt; &quot;memcpy:\n&quot;;
    char tmp1[1024] = {0};
    char tmp2[1024] = {&apos;a&apos;};
    int count = 1000;

    gettimeofday(&amp;t1, NULL);
    for (int i=0; i&lt;count; i++) {
        memcpy(tmp1, tmp2, sizeof(tmp1));
    }
    gettimeofday(&amp;t2, NULL);
    elapsedTime = (t2.tv_sec - t1.tv_sec) * 1000000.0; // sec to us
    elapsedTime += (t2.tv_usec - t1.tv_usec) ;
    cout &lt;&lt; &quot;\t&quot; &lt;&lt; elapsedTime &lt;&lt; &quot; us (by gettimeofday)\n&quot;;

    a = rdtsc();
    for (int i=0; i&lt;count; i++) {
        memcpy(tmp1, tmp2, sizeof(tmp1));
    }
    b = (rdtsc()-a)/count;
    cout &lt;&lt; &quot;\ttimestamp count is &quot; &lt;&lt; b &lt;&lt; &quot;, elapsedTime &quot; &lt;&lt; b/CPU_SPEED_US &lt;&lt; &quot; us\n&quot;;
    return 0;
}
</code></pre><h3 id="output"><a href="#output" class="headerlink" title="output"></a>output</h3><pre><code>dennis@dennis:~/tt$ g++ -O3 -o t t.cc
dennis@dennis:~/tt$ ./t
malloc:
    0 us (by gettimeofday)
    timestamp count is 58, elapsedTime 0.0460943 us
memcpy:
    0 us (by gettimeofday)
    timestamp count is 0, elapsedTime 0 us
dennis@dennis:~/tt$ g++ -O2 -o t t.cc
dennis@dennis:~/tt$ ./t
malloc:
    0 us (by gettimeofday)
    timestamp count is 69, elapsedTime 0.0548363 us
memcpy:
    0 us (by gettimeofday)
    timestamp count is 0, elapsedTime 0 us
dennis@dennis:~/tt$ g++ -O1 -o t t.cc
dennis@dennis:~/tt$ ./t
malloc:
    0 us (by gettimeofday)
    timestamp count is 58, elapsedTime 0.0460943 us
memcpy:
    2 us (by gettimeofday)
    timestamp count is 3, elapsedTime 0.00238419 us
dennis@dennis:~/tt$ g++ -o t t.cc
dennis@dennis:~/tt$ ./t
malloc:
    80 us (by gettimeofday)
    timestamp count is 1198, elapsedTime 0.952085 us
memcpy:
    102 us (by gettimeofday)
    timestamp count is 295, elapsedTime 0.234445 us
dennis@dennis:~/tt$ g++ -g -o t t.cc
dennis@dennis:~/tt$ ./t
malloc:
    82 us (by gettimeofday)
    timestamp count is 1421, elapsedTime 1.12931 us
memcpy:

    timestamp count is 295, elapsedTime 0.234445 us
</code></pre><h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://stackoverflow.com/questions/23402701/function-asm-volatile-rdtsc" target="_blank" rel="external">http://stackoverflow.com/questions/23402701/function-asm-volatile-rdtsc</a></li>
<li><a href="http://www.mcs.anl.gov/~kazutomo/rdtsc.html" target="_blank" rel="external">Time-stamp Counter</a></li>
<li><a href="http://www.cnblogs.com/cnmaizi/archive/2011/01/17/1937772.html" target="_blank" rel="external">X86平台采用rdtsc指令读取时间戳计数器完成高精度计时</a></li>
<li><a href="http://www.strchr.com/performance_measurements_with_rdtsc" target="_blank" rel="external">Performance measurements with RDTSC</a></li>
<li><a href="http://stackoverflow.com/questions/2150291/how-do-i-measure-a-time-interval-in-c" target="_blank" rel="external">http://stackoverflow.com/questions/2150291/how-do-i-measure-a-time-interval-in-c</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/10/24/rdtsc/" data-id="ciqqpe1tt00dcnmpvdl308uga" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/c/">c++</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/time/">time</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-unit-test" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/10/22/unit-test/" class="article-date">
  <time datetime="2015-10-21T16:00:00.000Z" itemprop="datePublished">2015-10-22</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/program/">program</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/10/22/unit-test/">unit test</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="cppmock"><a href="#cppmock" class="headerlink" title="cppmock"></a>cppmock</h3><h3 id="gmock"><a href="#gmock" class="headerlink" title="gmock"></a>gmock</h3><h3 id="exception"><a href="#exception" class="headerlink" title="exception"></a>exception</h3><ul>
<li>network exception, such as connection timeout, receive/send failure<ul>
<li>connect refused<ul>
<li>use exist IP, but port is not listened, then the connect operation will return error <code>connect refused</code></li>
<li>hook connect function</li>
<li>iptables,  <code>iptables -t filter -p tcp -A OUTPUT -d DEST_IP --dport DEST_PORT -j REJECT --reject-with tcp-reset</code></li>
</ul>
</li>
<li>connect timeout</li>
<li>read timeout</li>
<li>write timeout</li>
<li>disconnect when read/write</li>
<li>connect slowly</li>
<li>package dirty</li>
</ul>
</li>
<li>memory exception, such as not enough memory, allocation failure<ul>
<li>allocate fail<ul>
<li>hook malloc function</li>
</ul>
</li>
</ul>
</li>
<li>disk exception, such as disk crash, not enough space</li>
<li>program exception</li>
</ul>
<h3 id="reference"><a href="#reference" class="headerlink" title="reference"></a>reference</h3><ul>
<li><a href="http://baidutech.blog.51cto.com/4114344/744429" target="_blank" rel="external">异常模拟测试–场景抽象及解决方案</a></li>
<li><a href="http://www.sqlite.org/malloc.html#testing" target="_blank" rel="external">Test Dynamic Memory Allocation In SQLite</a></li>
<li><a href="http://stackoverflow.com/questions/1711170/unit-testing-for-failed-malloc" target="_blank" rel="external">Unit testing for failed malloc</a></li>
<li><a href="http://www.cnblogs.com/coderzh/archive/2009/04/06/1426755.html" target="_blank" rel="external">玩转Google开源C++单元测试框架Google Test系列(gtest)</a></li>
<li><a href="http://www.cnblogs.com/anderslly/archive/2009/07/26/better-unit-tests.html" target="_blank" rel="external">更好的单元测试准则</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/10/22/unit-test/" data-id="ciqqpe1tj00d3nmpvpek062jq" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/test/">test</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-spf13-vim" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2015/10/07/spf13-vim/" class="article-date">
  <time datetime="2015-10-06T16:00:00.000Z" itemprop="datePublished">2015-10-07</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/tools/">tools</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2015/10/07/spf13-vim/">spf13 vim</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="spf13-vim"><a href="#spf13-vim" class="headerlink" title="spf13 vim"></a>spf13 vim</h4><ul>
<li><a href="https://github.com/spf13/spf13-vim" target="_blank" rel="external">spf13 vim</a></li>
<li>Installation on linux</li>
<li><code>Requires Git 1.7+ and Vim 7.3+</code></li>
<li><code>curl https://j.mp/spf13-vim3 -L &gt; spf13-vim.sh &amp;&amp; sh spf13-vim.sh</code></li>
</ul>
<h4 id="install"><a href="#install" class="headerlink" title="install"></a>install</h4><pre><code>[dennis@localhost ~]$ curl https://j.mp/spf13-vim3 -L &gt; spf13-vim.sh 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   142  100   142    0     0     79      0  0:00:01  0:00:01 --:--:--    79
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
100  5214  100  5214    0     0   1036      0  0:00:05  0:00:05 --:--:--  6998
[dennis@localhost ~]$ sh spf13-vim.sh 
Attempting to back up your original vim configuration.
‘/home/dennis/.vim’ -&gt; ‘/home/dennis/.vim.20151007_1444202174’
‘/home/dennis/.vimrc’ -&gt; ‘/home/dennis/.vimrc.20151007_1444202174’
Trying to update spf13-vim
Cloning into &apos;/home/dennis/.spf13-vim-3&apos;...
remote: Counting objects: 3303, done.
remote: Total 3303 (delta 0), reused 0 (delta 0), pack-reused 3303
Receiving objects: 100% (3303/3303), 3.16 MiB | 16.00 KiB/s, done.
Resolving deltas: 100% (1485/1485), done.
Checking connectivity... done.
[✔] Successfully cloned spf13-vim.
[✔] Setting up vim symlinks.
Trying to update vundle
Cloning into &apos;/home/dennis/.vim/bundle/vundle&apos;...
remote: Counting objects: 2941, done.
remote: Total 2941 (delta 0), reused 0 (delta 0), pack-reused 2941
Receiving objects: 100% (2941/2941), 870.60 KiB | 19.00 KiB/s, done.
Resolving deltas: 100% (1012/1012), done.
Checking connectivity... done.
[✔] Successfully cloned vundle.
[✔] Now updating/installing plugins using Vundle

Thanks for installing spf13-vim.
© 2015 http://vim.spf13.com/

[dennis@localhost ~]$ ls .vim/bundle/
auto-pairs           tagbar                    vim-less
ctrlp-funky          tlib_vim                  vim-litecorrect
ctrlp.vim            undotree                  vim-markdown
fonts                vim-abolish               vim-multiple-cursors
gist-vim             vim-addon-mw-utils        vim-nerdtree-tabs
HTML-AutoCloseTag    vim-airline               vim-over
matchit.zip          vim-bufferline            vim-php-namespace
neocomplete.vim      vim-coffee-script         vim-preview
neosnippet           vim-coloresque            vim-rails
neosnippet-snippets  vim-colors                vim-repeat
nerdcommenter        vim-colorschemes          vim-signify
nerdtree             vim-colors-solarized      vim-snippets
PIV                  vim-commentary            vim-surround
pythoncomplete       vim-css3-syntax           vim-textobj-indent
python_match.vim     vim-cucumber              vim-textobj-quote
python-mode          vim-cucumber-align-pipes  vim-textobj-sentence
python.vim           vim-easymotion            vim-textobj-user
restore_view.vim     vim-fugitive              vim-toml
rust.vim             vim-haml                  vim-twig
salt-vim             vim-indent-guides         vim-wordy
sessionman.vim       vim-javascript            vundle
syntastic            vim-json                  webapi-vim
tabular              vim-jst                   wildfire.vim
[dennis@localhost ~]$ du .vim -sh
125M    .vim
[dennis@localhost ~]$ tar zcf tab.tar.gz .vim
[dennis@localhost ~]$ ls -lh tab.tar.gz 
-rw-rw-r--. 1 dennis dennis 67M Oct  7 17:07 tab.tar.gz
</code></pre><h4 id="Plugin-instroduce"><a href="#Plugin-instroduce" class="headerlink" title="Plugin instroduce"></a>Plugin instroduce</h4><ul>
<li>Vundle The best plugin manager</li>
<li>NERDTree<ul>
<li>quick start/close using <code>ctrl+e</code></li>
<li><code>o</code> open selected file</li>
<li><code>r</code> refresh selected folder</li>
<li><code>C</code> select root directory</li>
<li><code>m</code> add/delete/move/copy</li>
<li><code>ctrl+h/l</code> switch window to left or right</li>
</ul>
</li>
<li>ctrlp<ul>
<li>quick start/close with <code>ctrl+p</code></li>
</ul>
</li>
<li>Tagbar<ul>
<li>quick start/close with <code>&lt;leader&gt;tt</code></li>
</ul>
</li>
<li>EasyMotion<ul>
<li><code>,,w</code> move foreword</li>
<li><code>,,b</code> move backword</li>
</ul>
</li>
<li>Surround managing all the ‘“[{}]”‘ etc, using <code>:help surround</code> for more<ul>
<li><code>cs&#39;&quot;</code>  , change <code>&#39;</code> to <code>&quot;</code></li>
<li><code>ysiw&quot;</code> , add <code>&quot;</code> around the word</li>
<li><code>ysiw[</code></li>
<li><code>ysiw&lt;p&gt;</code></li>
<li><code>ds&#39;</code>  , delete <code>&#39;</code> around the word</li>
</ul>
</li>
<li>neocwomplcache autocomplete++</li>
<li>Fugitive<ul>
<li><code>&lt;leader&gt;gs</code> :Gstatus</li>
<li><code>&lt;leader&gt;gd</code> :Gdiff</li>
<li><code>&lt;leader&gt;gc</code> :Gcommit</li>
<li><code>&lt;leader&gt;gb</code> :Gblame</li>
<li><code>&lt;leader&gt;gl</code> :Glog</li>
<li><code>&lt;leader&gt;gp</code> :Git push</li>
</ul>
</li>
<li>Tabularize align everything<ul>
<li><code>&lt;Leader&gt;a=</code> :Tabularize /=</li>
<li><code>&lt;Leader&gt;a:</code> :Tabularize /:</li>
<li><code>&lt;Leader&gt;a::</code> :Tabularize /:\zs</li>
<li><code>&lt;Leader&gt;a,</code> :Tabularize /,</li>
<li><code>&lt;Leader&gt;a&lt;Bar&gt;</code> :Tabularize</li>
</ul>
</li>
<li>NERDCommenter<ul>
<li>allow you to wrangle your code comments.</li>
<li><code>&lt;leader&gt;c&lt;space&gt;</code></li>
</ul>
</li>
<li>numbers.vim<ul>
<li>better line numbers</li>
</ul>
</li>
<li>Airline<ul>
<li>provide a lightweight themable statusline with no external dependencies.</li>
</ul>
</li>
<li>Syntastic integrated syntax checking</li>
</ul>
<h4 id="Weakness"><a href="#Weakness" class="headerlink" title="Weakness"></a>Weakness</h4><ul>
<li>More suitable for the front-end program (html and python)</li>
<li>Too many plugins, and too big (100+MB)</li>
<li>Ag better than Ack</li>
<li>Not include vimshell and vimproc</li>
</ul>
<h4 id="Advantage-just-for-me"><a href="#Advantage-just-for-me" class="headerlink" title="Advantage (just for me)"></a>Advantage (just for me)</h4><ul>
<li>NERDTree</li>
<li>Tagbar</li>
<li>EasyMotion</li>
<li>Surround</li>
</ul>
<h4 id="More-powerful-plugin"><a href="#More-powerful-plugin" class="headerlink" title="More powerful plugin"></a>More powerful plugin</h4><ul>
<li>YouCompleteMe<ul>
<li><code>Bundle &#39;Valloric/YouCompleteMe&#39;</code></li>
<li><a href="https://github.com/Valloric/YouCompleteMe" target="_blank" rel="external">https://github.com/Valloric/YouCompleteMe</a></li>
<li><a href="http://blog.marchtea.com/archives/161" target="_blank" rel="external">http://blog.marchtea.com/archives/161</a></li>
<li><a href="http://zuyunfei.com/2013/05/16/killer-plugin-of-vim-youcompleteme/" target="_blank" rel="external">http://zuyunfei.com/2013/05/16/killer-plugin-of-vim-youcompleteme/</a></li>
<li><a href="http://www.linuxzen.com/vim-dai-ma-bu-quan-he-jian-cha-youcompleteme-syntastic.html" target="_blank" rel="external">http://www.linuxzen.com/vim-dai-ma-bu-quan-he-jian-cha-youcompleteme-syntastic.html</a></li>
<li><a href="http://www.yycmmc.com/?p=53" target="_blank" rel="external">http://www.yycmmc.com/?p=53</a></li>
<li><a href="http://blog.jobbole.com/58978/" target="_blank" rel="external">http://blog.jobbole.com/58978/</a></li>
</ul>
</li>
</ul>
<h3 id="YouCompleteMe-install-offline"><a href="#YouCompleteMe-install-offline" class="headerlink" title="YouCompleteMe install offline"></a>YouCompleteMe install offline</h3><ul>
<li><a href="http://pengblog.sinaapp.com/?cat=2" target="_blank" rel="external">http://pengblog.sinaapp.com/?cat=2</a></li>
<li><a href="https://github.com/haoren3696/ycm_complete.git" target="_blank" rel="external">https://github.com/haoren3696/ycm_complete.git</a></li>
</ul>
<h4 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h4><ul>
<li><a href="http://www.open-open.com/lib/view/open1342676273979.html" target="_blank" rel="external">spf13 vim how to</a></li>
<li><a href="http://beiyuu.com/git-vim-tutorial/" target="_blank" rel="external">Git时代的VIM不完全使用教程</a></li>
<li><a href="http://feihu.me/blog/2014/intro-to-vim/" target="_blank" rel="external">跟我一起学习VIM</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2015/10/07/spf13-vim/" data-id="ciqqpe1tg00d0nmpv4emvqef4" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/vim/">vim</a></li></ul>

    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    <a class="extend prev" rel="prev" href="/page/2/">&laquo; __('prev')</a><a class="page-number" href="/">1</a><a class="page-number" href="/page/2/">2</a><span class="page-number current">3</span><a class="page-number" href="/page/4/">4</a><a class="page-number" href="/page/5/">5</a><span class="space">&hellip;</span><a class="page-number" href="/page/18/">18</a><a class="extend next" rel="next" href="/page/4/">__('next') &raquo;</a>
  </nav>
</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Catégories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/blog/">blog</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/database/">database</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/english/">english</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/kernel/">kernel</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/language/">language</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/math/">math</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/network/">network</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/others/">others</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/person/">person</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/program/">program</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/source/">source</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/storage/">storage</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/tools/">tools</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/windows/">windows</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Mot-clés</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/FAQ/">FAQ</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/IRC/">IRC</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Translation/">Translation</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/">android</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/api/">api</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/assembly/">assembly</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/awk/">awk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/batch/">batch</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/blog/">blog</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/book/">book</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c++</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cache/">cache</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/crash/">crash</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/database/">database</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/debug/">debug</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/dot/">dot</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/driver/">driver</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/emacs/">emacs</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/exploit/">exploit</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/file-system/">file system</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/filesystem/">filesystem</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flowchart/">flowchart</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gcc/">gcc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/google/">google</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/graphviz/">graphviz</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hosts/">hosts</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/iscsi/">iscsi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/job/">job</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/json/">json</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/kernel/">kernel</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lisp/">lisp</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lua/">lua</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/makefile/">makefile</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/malloc/">malloc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/math/">math</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/maxima/">maxima</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory/">memory</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory-overflow/">memory overflow</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mtrace/">mtrace</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/netdisk/">netdisk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/network/">network</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/others/">others</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pandoc/">pandoc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/performance/">performance</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/person/">person</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/protobuf/">protobuf</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/">python</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rsync/">rsync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sed/">sed</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/shell/">shell</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/skype/">skype</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sms/">sms</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/source/">source</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ssh/">ssh</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/stack/">stack</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/storage/">storage</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/study/">study</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/svn/">svn</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sync/">sync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/test/">test</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/time/">time</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tools/">tools</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/valgrind/">valgrind</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vi/">vi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/">vim</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/virtual/">virtual</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wget/">wget</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/windows/">windows</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wireshark/">wireshark</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/write/">write</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/xml/">xml</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Nuage de mot-clés</h3>
    <div class="widget tagcloud">
      <a href="/tags/FAQ/" style="font-size: 10px;">FAQ</a> <a href="/tags/IRC/" style="font-size: 10px;">IRC</a> <a href="/tags/Translation/" style="font-size: 13px;">Translation</a> <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/api/" style="font-size: 10px;">api</a> <a href="/tags/assembly/" style="font-size: 10px;">assembly</a> <a href="/tags/awk/" style="font-size: 11px;">awk</a> <a href="/tags/batch/" style="font-size: 14px;">batch</a> <a href="/tags/blog/" style="font-size: 10px;">blog</a> <a href="/tags/book/" style="font-size: 10px;">book</a> <a href="/tags/c/" style="font-size: 16px;">c</a> <a href="/tags/c/" style="font-size: 19px;">c++</a> <a href="/tags/cache/" style="font-size: 10px;">cache</a> <a href="/tags/crash/" style="font-size: 10px;">crash</a> <a href="/tags/database/" style="font-size: 17px;">database</a> <a href="/tags/debug/" style="font-size: 12px;">debug</a> <a href="/tags/dot/" style="font-size: 10px;">dot</a> <a href="/tags/driver/" style="font-size: 10px;">driver</a> <a href="/tags/emacs/" style="font-size: 11px;">emacs</a> <a href="/tags/exploit/" style="font-size: 10px;">exploit</a> <a href="/tags/file-system/" style="font-size: 10px;">file system</a> <a href="/tags/filesystem/" style="font-size: 12px;">filesystem</a> <a href="/tags/flowchart/" style="font-size: 10px;">flowchart</a> <a href="/tags/gcc/" style="font-size: 10px;">gcc</a> <a href="/tags/git/" style="font-size: 12px;">git</a> <a href="/tags/google/" style="font-size: 11px;">google</a> <a href="/tags/graphviz/" style="font-size: 11px;">graphviz</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/hosts/" style="font-size: 10px;">hosts</a> <a href="/tags/iscsi/" style="font-size: 14px;">iscsi</a> <a href="/tags/java/" style="font-size: 10px;">java</a> <a href="/tags/javascript/" style="font-size: 10px;">javascript</a> <a href="/tags/job/" style="font-size: 10px;">job</a> <a href="/tags/json/" style="font-size: 10px;">json</a> <a href="/tags/kernel/" style="font-size: 14px;">kernel</a> <a href="/tags/linux/" style="font-size: 14px;">linux</a> <a href="/tags/lisp/" style="font-size: 10px;">lisp</a> <a href="/tags/lua/" style="font-size: 10px;">lua</a> <a href="/tags/makefile/" style="font-size: 10px;">makefile</a> <a href="/tags/malloc/" style="font-size: 10px;">malloc</a> <a href="/tags/math/" style="font-size: 11px;">math</a> <a href="/tags/maxima/" style="font-size: 10px;">maxima</a> <a href="/tags/memory/" style="font-size: 11px;">memory</a> <a href="/tags/memory-overflow/" style="font-size: 10px;">memory overflow</a> <a href="/tags/mtrace/" style="font-size: 10px;">mtrace</a> <a href="/tags/netdisk/" style="font-size: 10px;">netdisk</a> <a href="/tags/network/" style="font-size: 20px;">network</a> <a href="/tags/others/" style="font-size: 18px;">others</a> <a href="/tags/pandoc/" style="font-size: 10px;">pandoc</a> <a href="/tags/performance/" style="font-size: 16px;">performance</a> <a href="/tags/person/" style="font-size: 11px;">person</a> <a href="/tags/protobuf/" style="font-size: 11px;">protobuf</a> <a href="/tags/python/" style="font-size: 10px;">python</a> <a href="/tags/rsync/" style="font-size: 10px;">rsync</a> <a href="/tags/sed/" style="font-size: 11px;">sed</a> <a href="/tags/shell/" style="font-size: 15px;">shell</a> <a href="/tags/skype/" style="font-size: 11px;">skype</a> <a href="/tags/sms/" style="font-size: 10px;">sms</a> <a href="/tags/source/" style="font-size: 11px;">source</a> <a href="/tags/ssh/" style="font-size: 10px;">ssh</a> <a href="/tags/stack/" style="font-size: 10px;">stack</a> <a href="/tags/storage/" style="font-size: 15px;">storage</a> <a href="/tags/study/" style="font-size: 10px;">study</a> <a href="/tags/svn/" style="font-size: 11px;">svn</a> <a href="/tags/sync/" style="font-size: 10px;">sync</a> <a href="/tags/test/" style="font-size: 11px;">test</a> <a href="/tags/time/" style="font-size: 10px;">time</a> <a href="/tags/tools/" style="font-size: 16px;">tools</a> <a href="/tags/valgrind/" style="font-size: 10px;">valgrind</a> <a href="/tags/vi/" style="font-size: 10px;">vi</a> <a href="/tags/vim/" style="font-size: 14px;">vim</a> <a href="/tags/virtual/" style="font-size: 11px;">virtual</a> <a href="/tags/wget/" style="font-size: 10px;">wget</a> <a href="/tags/windows/" style="font-size: 11px;">windows</a> <a href="/tags/wireshark/" style="font-size: 10px;">wireshark</a> <a href="/tags/write/" style="font-size: 13px;">write</a> <a href="/tags/xml/" style="font-size: 10px;">xml</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">July 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">April 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/02/">February 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">January 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">November 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">October 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">September 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/07/">July 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/06/">June 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">March 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">February 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/01/">January 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">December 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">November 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/09/">September 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/08/">August 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/07/">July 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/06/">June 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/05/">May 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/04/">April 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/03/">March 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/11/">November 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/09/">September 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/08/">August 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/07/">July 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/05/">May 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/04/">April 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/03/">March 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/02/">February 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/01/">January 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/12/">December 2012</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/09/">September 2012</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Articles récents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2016/07/17/how-to-implement-malloc/">如何实现一个malloc</a>
          </li>
        
          <li>
            <a href="/2016/07/17/study-grep-more/">grep工作原理</a>
          </li>
        
          <li>
            <a href="/2016/07/17/2016-04-13-malloc/">malloc</a>
          </li>
        
          <li>
            <a href="/2016/04/27/include-what-you-use/">使用IWYU整理头文件引用</a>
          </li>
        
          <li>
            <a href="/2016/04/24/understand-gcc-assembly-output/">understand gcc assembly output</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2016 Matrix207<br>
      Propulsé by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>